package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;


@Getter
public enum AuditContentTypeEnum implements IEnum<Integer> {
    MODEXBEAN_QUESTION(0,"求索-问题"),
    MODEXBEAN_POINT(1,"求索-观点"),
    MODEXBEAN_ANSWER(2,"求索-回答"),
    MODEXBEAN_ANSWER_COMMENT(3,"求索-评论"),
    ISLAND_POST(4,"浪屿-帖子"),
    ISLAND_COMMENT(5,"浪屿-回复"),
    PADDLE_COMMENT(6,"知桨-回复"),
    PADDLE_SUGGESTION(7,"知桨-箴言")

    ;

    private int type;

    private String name;

    AuditContentTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }


    public static AuditContentTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static AuditContentTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }

}
